//
//  ThirdaConViewController.m
//  Four_years
//
//  Created by 中软国际019 on 15/11/10.
//  Copyright © 2015年 中软三班四年小组. All rights reserved.
//

#import "ThirdaConViewController.h"
#import "SecondaViewController.h"
#import "ValueSender.h"

@interface ThirdaConViewController (){
    UILabel *name;
    UITextField *nametf;
    UILabel *sex;
    UITextField *sextf;
    UILabel *birthday;
    UITextField *birthdaytf;
    UILabel *college;
    UITextField *collegetf;
    UILabel *speciality;
    UITextField *specialitytf;
    
}

@end

@implementation ThirdaConViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor=[UIColor orangeColor];
    name=[[UILabel alloc]initWithFrame:CGRectMake(WIDTH/20, HEIGHT/80+100, 170, 30)];
    name.text=@"昵称";
    
    nametf=[[UITextField alloc]initWithFrame:CGRectMake(200, HEIGHT/80+100, 170, 30)];
    nametf.borderStyle=UITextBorderStyleRoundedRect;
    
    sex=[[UILabel alloc]initWithFrame:CGRectMake(15, HEIGHT/80+150, 170, 30)];
    sex.text=@"性别";
    
    sextf=[[UITextField alloc]initWithFrame:CGRectMake(200, HEIGHT/80+150, 170, 30)];
    sextf.borderStyle=UITextBorderStyleRoundedRect;
    
    birthday=[[UILabel alloc]initWithFrame:CGRectMake(15, HEIGHT/80+200, 170, 30)];
    birthday.text=@"出生日期";
    
    birthdaytf=[[UITextField alloc]initWithFrame:CGRectMake(200, HEIGHT/80+200, 170, 30)];
    birthdaytf.borderStyle=UITextBorderStyleRoundedRect;
    
    college=[[UILabel alloc]initWithFrame:CGRectMake(15, HEIGHT/80+250, 170, 30)];
    college.text=@"学校";
    
    collegetf=[[UITextField alloc]initWithFrame:CGRectMake(200, HEIGHT/80+250, 170, 30)];
    collegetf.borderStyle=UITextBorderStyleRoundedRect;
    
    speciality=[[UILabel alloc]initWithFrame:CGRectMake(15, HEIGHT/80+300, 170, 30)];
    speciality.text=@"专业";
    
    specialitytf=[[UITextField alloc]initWithFrame:CGRectMake(200, HEIGHT/80+300, 170, 30)];
    specialitytf.borderStyle=UITextBorderStyleRoundedRect;
    
    UIButton *button=[[UIButton alloc]initWithFrame:CGRectMake(WIDTH/2-50, HEIGHT/2+100, 100, 30)];
    button.backgroundColor=[UIColor colorWithRed:62/255.0 green:193/255.0 blue:209/255.0 alpha:1];
    
    [button setTitle:@"确定" forState:UIControlStateNormal];
    [button addTarget:self action:@selector(click:) forControlEvents:UIControlEventTouchUpInside];
    
    
    [self.view addSubview:button];
    [self.view addSubview:name];
    [self.view addSubview:nametf];
    [self.view addSubview:sex];
    [self.view addSubview:sextf];
    [self.view addSubview:birthday];
    [self.view addSubview:birthdaytf];
    [self.view addSubview:college];
    [self.view addSubview:collegetf];
    [self.view addSubview:speciality];
    [self.view addSubview:specialitytf];
    
    UITapGestureRecognizer *tap=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(closeKeyboard:)];
    
    [self.view addGestureRecognizer:tap];
    
    
}

//关闭键盘
- (void)closeKeyboard:(UITapGestureRecognizer *)tap {
    if (tap.view == self.view) {//多余的
        [self.view endEditing:YES];
    }
}

// 按钮的点击事件
-(void)click:(UIButton *)button{
//    SecondaViewController *secondaCtr=[[SecondaViewController alloc]init];
    ValueSender *valueSender=[ValueSender getInstance];
    valueSender.name=nametf.text;
    valueSender.sex=sextf.text;
    valueSender.birthday=birthdaytf.text;
    valueSender.school=collegetf.text;
    valueSender.speciality=specialitytf.text;
    [self.navigationController popViewControllerAnimated:YES];
}
-(void)viewWillDisappear:(BOOL)animated{
    [super viewWillDisappear:YES];
    
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
